package com.ethink.platform.controller.warehouse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.ethink.framework.common.web.BaseController;
import com.ethink.framework.common.web.response.CommonResponse;
import com.ethink.warehouse.api.MateInventoryOtherInLogDetailFacade;
import com.ethink.warehouse.api.info.MateInventoryOtherInLogDetailInfo;
import com.ethink.warehouse.api.request.MateInventoryOtherInLogDetailAddRequest;
import com.ethink.warehouse.api.request.MateInventoryOtherInLogDetailQueryRequest;
import com.ethink.warehouse.api.request.MateInventoryOtherInLogDetailUpdateRequest;

/**
 * 其他入库明细 Controller
 *
 * @author default
 * @date 2023-02-09
 */
@Tag(name = "MateInventoryOtherInLogDetailController", description = "其他入库明细 Controller")
@RestController
@Slf4j
@RequestMapping("platform-server/v1/warehouse-service")
public class MateInventoryOtherInLogDetailController extends BaseController {

    @Autowired
    private MateInventoryOtherInLogDetailFacade mateInventoryOtherInLogDetailFacade;

    @Operation(summary = "分页查询")
    @GetMapping("/mateInventoryOtherInLogDetail/query")
    public CommonResponse<List<MateInventoryOtherInLogDetailInfo>> queryMateInventoryOtherInLogDetail(MateInventoryOtherInLogDetailQueryRequest request) {
        return succeedWithPage(mateInventoryOtherInLogDetailFacade.queryMateInventoryOtherInLogDetail(request));
    }

    @Operation(summary = "详情查询")
    @GetMapping("/mateInventoryOtherInLogDetail/get/{mateInventoryOtherInLogDetailId}")
    public CommonResponse<MateInventoryOtherInLogDetailInfo> getMateInventoryOtherInLogDetailById(@PathVariable("mateInventoryOtherInLogDetailId") Long mateInventoryOtherInLogDetailId) {
        return succeedWith(mateInventoryOtherInLogDetailFacade.getMateInventoryOtherInLogDetailById(mateInventoryOtherInLogDetailId));
    }

    @Operation(summary = "查询所有")
    @GetMapping("/mateInventoryOtherInLogDetail/list")
    public CommonResponse<List<MateInventoryOtherInLogDetailInfo>> listMateInventoryOtherInLogDetail(MateInventoryOtherInLogDetailQueryRequest request) {
        return succeedWith(mateInventoryOtherInLogDetailFacade.listMateInventoryOtherInLogDetail(request));
    }

    @Operation(summary = "新增")
    @PostMapping("/mateInventoryOtherInLogDetail/add")
    public CommonResponse addMateInventoryOtherInLogDetail(@RequestBody MateInventoryOtherInLogDetailAddRequest request) {
        mateInventoryOtherInLogDetailFacade.addMateInventoryOtherInLogDetail(request);
        return succeed();
    }

    @Operation(summary = "更新")
    @PutMapping("/mateInventoryOtherInLogDetail/update")
    public CommonResponse updateMateInventoryOtherInLogDetail(@RequestBody MateInventoryOtherInLogDetailUpdateRequest request) {
        mateInventoryOtherInLogDetailFacade.updateMateInventoryOtherInLogDetail(request);
        return succeed();
    }

    @Operation(summary = "删除")
    @PutMapping("/mateInventoryOtherInLogDetail/delete/{mateInventoryOtherInLogDetailId}")
    public CommonResponse deleteMateInventoryOtherInLogDetail(@PathVariable("mateInventoryOtherInLogDetailId") Long mateInventoryOtherInLogDetailId) {
        mateInventoryOtherInLogDetailFacade.deleteMateInventoryOtherInLogDetail(mateInventoryOtherInLogDetailId);
        return succeed();
    }

}